﻿<%@ WebHandler Language="C#" Class="AjaxController" %>

using System;
using System.Web;

using DarrenAjax.Utility;

using SixLottery.Common;
using SixLottery.Models;


public class AjaxController : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
    public void ProcessRequest (HttpContext context) {       
        
        string className = context.Request["_class"];
        string method = context.Request["_method"];

        if (!"login".Equals(method, StringComparison.OrdinalIgnoreCase))
        {
            Member currentMember = CommonHelper.GetCurrentMember();
            
            if (string.IsNullOrEmpty(currentMember.UserName))
            {
                context.Response.Write("没有登录,或登录信息异常");
                context.Response.End();    
            }            
        }

        Type currentType = Type.GetType(className, false, true);
        if (currentType == null)
        {
            context.Response.Write("请提供_class");
        }        
        
        jQueryAjaxUtility.RegisterAjaxInvokeEvent(currentType);
    }
 
    public bool IsReusable {
        get {
            return true;
        }
    }

}